package com.lghs.stutor;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;

public class MainActivity extends Activity {
    Handler handler = new Handler();
    Runnable runnable;
    ImageView ivsplash;

    protected void onCreate(Bundle savedInstanceState) {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        ivsplash = (ImageView) findViewById(R.id.splashscreen_imageView_splash);
        // Splash Screen
        runnable = new Runnable() {
            public void run() {
                Intent intent = new Intent(getApplicationContext(), Login.class);
                startActivity(intent);
                handler.removeCallbacks(runnable);
                finish();
                ivsplash.setImageBitmap(null);
            }
        };
        handler.postDelayed(runnable, 1500); // 2 seconds of splash screen.
    }

    public void onBackPressed() {
        Toast msg = Toast.makeText(this, "Goodbye!", Toast.LENGTH_SHORT);
        msg.show();
        finish();
    }
}
